
cc.Class({
    extends: cc.Component,

    properties: {
        
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.func;
        this.text = this.node.getComponent(cc.Label);
        
    },

    start () {
    },
    setText(data){
        
        // var text='';
        // var arr=data.split('');
        // var step=0;
        // var len=arr.length;
        // var self=this;
        // self.func = function () {
        //     text += arr[step];
        //     self.text.string = text;
        //     if (++step == len) {
        //         self.unschedule(self.func, self);
        //     }
        // }
        var index = 0;
        this.func=function(){
            var str = data.substring(0,index++)
            this.text.string=str
        }
        this.schedule(this.func,0.05)
    },
    next(){
        this.unschedule(this.func)
    },


    // update (dt) {},
});
